name: Rust

on:
  release:
    types: [published] # Only publish to crates.io when we formally publish a release
  # For more on how to formally release cloudflare-rs, check out https://help.github.com/en/articles/creating-releases

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Login to crates.io
      run: cargo login $CRATES_IO_TOKEN
      env:
        CRATES_IO_TOKEN: ${{ secrets.crates_io_token }} # https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables
    - name: Dry run publish
      run: cargo publish --dry-run --manifest-path cloudflare/Cargo.toml
    - name: Publish
      run: cargo publish --manifest-path cloudflare/Cargo.toml
